/*
 * @Author: guandeshen 295570679@qq.com
 * @Date: 2024-08-20 11:05:08
 * @LastEditors: guandeshen 295570679@qq.com
 * @LastEditTime: 2024-08-31 11:24:30
 * @FilePath: /task-admin/src/api/menu/index.ts
 * @Description:
 *
 * Copyright (c) 2024 by RSC, All Rights Reserved.
 */
import request from "@/utils/request";
import { MenuQuery, MenuList, MenuForm, MenuTreeList } from "./model";

class MenuAPI {
  /**
   * 获取分页列表
   *
   * @data data
   */
  static getPage(data: MenuQuery) {
    return request<any, PageResult<MenuList[]>>({
      url: "/tenant/rules/treelist",
      method: "post",
      data: data,
    });
  }
  static getTree(data: MenuQuery) {
    return request<any, MenuTreeList[]>({
      url: "/tenant/rules/treelist",
      method: "post",
      data: data,
    });
  }
  static getRoutes(data: MenuQuery) {
    return request<any, MenuTreeList[]>({
      url: "/tenant/rules/myrules",
      method: "post",
      data: data,
    });
  }
  /**
   * 添加编辑
   *
   * @data data
   */

  static add(data: MenuForm) {
    return request({
      url: "/tenant/rules/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除
   *
   * @data data
   */

  static deleteByIds(data: Ids) {
    return request({
      url: "/tenant/rules/del",
      method: "post",
      data: data,
    });
  }
}

export default MenuAPI;
